package com.example.mymicaihu.adapter.home;

import android.content.Context;
import android.util.Log;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.mvplibrary.adapter.BaseAdapter;
import com.example.mvplibrary.adapter.BaseViewHolder;
import com.example.mymicaihu.R;
import com.example.mymicaihu.bean.GameBean;

import java.util.List;


/**
 * 作者：朱勇闯
 * data : 2021/4/25  17:02
 * 作用： xxxx
 */
public class GameAdapter2 extends BaseAdapter<GameBean.GameListBean> {
    private static final String TAG = "朱勇闯Adapter";
    public ItemListener itemListener;

    public void setItemListener(ItemListener itemListener) {
        this.itemListener = itemListener;
    }

    public GameAdapter2(List<GameBean.GameListBean> datas, Context context, int layoutId) {
        super(datas, context, layoutId);
    }

    @Override
    protected void bindData(BaseViewHolder holder, GameBean.GameListBean listBean, int position) {
        Log.e(TAG, "bindData: " + listBean.getTitle());
        TextView name = holder.getView(R.id.tv_item_game_class_game_name);
        RecyclerView rv_list = holder.getView(R.id.rv_item_game_class_game);
        name.setText(listBean.getTitle());

        LinearLayoutManager manager = new LinearLayoutManager(context);
        manager.setOrientation(LinearLayoutManager.HORIZONTAL);
        rv_list.setLayoutManager(manager);
        GameTagAdapter gameTagAdapter = new GameTagAdapter(listBean.getRankList(), context, R.layout.item_recy_game_class);
        rv_list.setAdapter(gameTagAdapter);

    }

    public interface ItemListener {
        void onItemClickListener(int pos);
    }
}
